﻿<div class="panel panel-default">
    <div class="note note-info">
        <p>
            <h4>@T("Admin.Configuration.Settings.Order.ReturnRequestReasons")</h4>
        </p>
        <p>
            <em>@T("Admin.Configuration.Settings.Order.ReturnRequestReasons.Hint")</em>
        </p>
    </div>
    <div class="panel-body">
        <div id="returnrequestreasons-grid"></div>
    </div>
    <div class="panel-footer">
        <a href="@Url.Action("ReturnRequestReasonCreate")" class="k-button"><i class="fa fa-plus"></i>&nbsp;@T("Admin.Common.AddNew")</a>
    </div>
</div>

<script>
$(document).ready(function () {
    $("#returnrequestreasons-grid").kendoGrid({
        dataSource: {
            transport: {
                read: {
                    url: "@Html.Raw(Url.Action("ReturnRequestReasonList"))",
                    type: "POST",
                    dataType: "json",
                    data: addAntiForgeryToken
                }
            },
            schema: {
                data: "Data",
                total: "Total",
                errors: "Errors"
            },
            error: function(e) {
                display_kendoui_grid_error(e);
                // Cancel the changes
                this.cancelChanges();
            },
            serverPaging: true,
            serverFiltering: true,
            serverSorting: true
        },
        pageable: {
            refresh: true,
            numeric: false,
            previousNext: false,
            info: false
        },
        editable: {
            confirmation: false,
            mode: "inline"
        },
        scrollable: false,
        columns: [{
            field: "Name",
            title: "@T("Admin.Configuration.Settings.Order.ReturnRequestReasons.Name")",
            width: 300,
            template: '<a class="k-link" href="@Url.Action("ReturnRequestReasonEdit", "Setting")/#=Id#">#=kendo.htmlEncode(Name)#</a>',
        }, {
            field: "DisplayOrder",
            title: "@T("Admin.Configuration.Settings.Order.ReturnRequestReasons.DisplayOrder")",
            width: 100
        }]
    });
});
</script>